package top.stmo.spring.ioc.test2.dao.impl;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import top.stmo.spring.ioc.test2.dao.BookDao;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

//@Component
@Repository
@Scope("prototype")             //设置当前bean为多例,singleton（默认值,单例）prototype（非单例）
public class BookDaoImpl implements BookDao {

    @Override
    public void save() {
        System.out.println("book dao save");
    }

    @PostConstruct              //指定当前方法为当前bean的初始化方法
    public void init() {

    }

    @PreDestroy                 //指定当前方法为当前bean的销毁方法
    public void destroy() {

    }


}
